package com.icesoft.x.demo;

import java.util.ArrayList;
import java.util.List;

import javax.faces.event.ActionEvent;

//In ICEfaces 1.7, the SessionRenderer is in an "experimental" package
//import org.icefaces.x.core.push.SessionRenderer;

//In ICEfaces 1.8, the SessionRenderer now resides in the official package
import com.icesoft.faces.async.render.IntervalRenderer;
import com.icesoft.faces.async.render.RenderManager;
import com.icesoft.faces.async.render.SessionRenderer;


public class ApplicationState {
	private RenderManager renderManager;
	private IntervalRenderer clock;
	static List data = new ArrayList();
	 static boolean stateInit = false;
	//import org.icefaces.x.core.push.SessionRenderer;

	
    public ApplicationState() {
    }

    public synchronized void updateSession(){
      
        SessionRenderer.render("all");
    }
    
   
    
    static  synchronized  void setArt (List art) {
    	setData(art);
    	stateInit = true;
    }
    
    /**
	 * @return the data
	 */
	static List getData() {
		return data;
	}
	
	
	/**
	 * @param data the data to set
	 */
	static void setData(List _data) {
		data = _data;
	}

	/**
	 * @return the stateInit
	 */
	public static boolean isStateInit() {
		return stateInit;
	}

	/**
	 * @param stateInit the stateInit to set
	 */
	public static void setStateInit(boolean stateInit) {
		ApplicationState.stateInit = stateInit;
	}

	static synchronized boolean getState () {
    	return stateInit;
    }

   
    public void setRenderManager(RenderManager renderManager) {
    	 clock = renderManager.getIntervalRenderer("clock");
       
    }

    /**
     * Gets RenderManager
     *
     * @return RenderManager null
     */
    public RenderManager getRenderManager() {
        return null;
    }

}
